package com.obaamilos.accesscontrol;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.SwingConstants;
import java.awt.FlowLayout;
import javax.swing.JList;
import javax.swing.ListSelectionModel;
import javax.swing.AbstractListModel;
import javax.swing.border.BevelBorder;
import javax.swing.JScrollPane;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.border.LineBorder;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JRadioButton;
import javax.swing.JTextArea;

public class Principal {

	private JFrame frame;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JTextField textField_4;
	private JTextField textField_5;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
				try {
					Principal window = new Principal();
					window.frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
	}

	/**
	 * Create the application.
	 */
	public Principal() {
		initialize();
	}

	/**
	 * Initialize the contents of the frame.
	 */
	private void initialize() {
		frame = new JFrame();
		frame.setBounds(100, 100, 674, 443);
		frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
		
		JPanel pnlUsuarios = new JPanel();
		tabbedPane.addTab("Usu\u00E1rios", null, pnlUsuarios, null);
		pnlUsuarios.setLayout(null);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(5, 26, 312, 165);
		pnlUsuarios.add(scrollPane);
		
		JList lstUsuarios = new JList();
		scrollPane.setViewportView(lstUsuarios);
		lstUsuarios.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
		lstUsuarios.setModel(new AbstractListModel() {
			String[] values = new String[] {"Pedro Oliveira - pedro - abc123", "Ana Maria - maria - xcx3434", "Julia Oliveira - julia - rd3434"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		lstUsuarios.setSelectedIndex(0);
		lstUsuarios.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		
		JLabel lblUsurios = new JLabel("Usu\u00E1rios:");
		lblUsurios.setBounds(5, 11, 85, 14);
		pnlUsuarios.add(lblUsurios);
		
		JPanel pnlNovoUsuario = new JPanel();
		pnlNovoUsuario.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
		pnlNovoUsuario.setBounds(340, 50, 293, 141);
		pnlUsuarios.add(pnlNovoUsuario);
		pnlNovoUsuario.setLayout(null);
		
		JLabel lblId = new JLabel("ID:");
		lblId.setHorizontalAlignment(SwingConstants.TRAILING);
		lblId.setBounds(29, 10, 50, 14);
		pnlNovoUsuario.add(lblId);
		
		textField = new JTextField();
		textField.setBounds(89, 7, 175, 20);
		pnlNovoUsuario.add(textField);
		textField.setColumns(10);
		
		JLabel lblLogin = new JLabel("Login:");
		lblLogin.setHorizontalAlignment(SwingConstants.TRAILING);
		lblLogin.setBounds(29, 34, 50, 14);
		pnlNovoUsuario.add(lblLogin);
		
		textField_1 = new JTextField();
		textField_1.setBounds(89, 31, 175, 20);
		pnlNovoUsuario.add(textField_1);
		textField_1.setColumns(10);
		
		JLabel lblNome = new JLabel("Nome:");
		lblNome.setHorizontalAlignment(SwingConstants.TRAILING);
		lblNome.setBounds(29, 58, 50, 14);
		pnlNovoUsuario.add(lblNome);
		
		textField_2 = new JTextField();
		textField_2.setBounds(89, 55, 175, 20);
		pnlNovoUsuario.add(textField_2);
		textField_2.setColumns(10);
		
		JLabel lblSenha = new JLabel("Senha:");
		lblSenha.setHorizontalAlignment(SwingConstants.TRAILING);
		lblSenha.setBounds(29, 82, 50, 14);
		pnlNovoUsuario.add(lblSenha);
		
		textField_3 = new JTextField();
		textField_3.setBounds(89, 79, 175, 20);
		pnlNovoUsuario.add(textField_3);
		textField_3.setColumns(10);
		
		JButton btnIncluir_1 = new JButton("<<-- Incluir");
		btnIncluir_1.setBounds(89, 106, 175, 23);
		pnlNovoUsuario.add(btnIncluir_1);
		
		JButton btnAtualiza = new JButton("Atualizar Lista");
		btnAtualiza.setBounds(15, 196, 100, 23);
		pnlUsuarios.add(btnAtualiza);
		
		JButton btnExcluir = new JButton("Excluir");
		btnExcluir.setBounds(201, 196, 100, 23);
		pnlUsuarios.add(btnExcluir);
		
		JLabel lblPerfil = new JLabel("Perfil Usu\u00E1rio:");
		lblPerfil.setBounds(5, 236, 85, 14);
		pnlUsuarios.add(lblPerfil);
		
		JScrollPane scrollPane_1 = new JScrollPane();
		scrollPane_1.setBounds(5, 252, 186, 117);
		pnlUsuarios.add(scrollPane_1);
		
		JList lstPerfisUsuario = new JList();
		lstPerfisUsuario.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		scrollPane_1.setViewportView(lstPerfisUsuario);
		
		JButton btnAtualizaPerfis = new JButton("Atualizar Lista");
		btnAtualizaPerfis.setBounds(201, 315, 100, 23);
		pnlUsuarios.add(btnAtualizaPerfis);
		
		JButton btnNewButton_1 = new JButton("Excluir Perfil");
		btnNewButton_1.setBounds(201, 342, 100, 23);
		pnlUsuarios.add(btnNewButton_1);
		
		JLabel lblNovoUsurio = new JLabel("Novo Usu\u00E1rio");
		lblNovoUsurio.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblNovoUsurio.setHorizontalAlignment(SwingConstants.CENTER);
		lblNovoUsurio.setBounds(340, 30, 293, 14);
		pnlUsuarios.add(lblNovoUsurio);
		
		JPanel panel_3 = new JPanel();
		panel_3.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
		panel_3.setBounds(311, 218, 322, 152);
		pnlUsuarios.add(panel_3);
		panel_3.setLayout(null);
		
		JLabel label_1 = new JLabel("Perfis:");
		label_1.setBounds(10, 5, 31, 14);
		panel_3.add(label_1);
		
		JScrollPane scrollPane_6 = new JScrollPane();
		scrollPane_6.setBounds(10, 20, 302, 97);
		panel_3.add(scrollPane_6);
		
		JList lstPerfisAAssociar = new JList();
		scrollPane_6.setViewportView(lstPerfisAAssociar);
		
		JButton btnAssociarPerfilUsuario = new JButton("<<-- Incluir");
		btnAssociarPerfilUsuario.setBounds(10, 123, 302, 23);
		panel_3.add(btnAssociarPerfilUsuario);
		
		JPanel pnlRecursos = new JPanel();
		tabbedPane.addTab("Recursos", null, pnlRecursos, null);
		pnlRecursos.setLayout(null);
		
		JScrollPane scrollPane_2 = new JScrollPane();
		scrollPane_2.setBounds(10, 25, 217, 176);
		pnlRecursos.add(scrollPane_2);
		
		JList lstRecursos = new JList();
		lstRecursos.setModel(new AbstractListModel() {
			String[] values = new String[] {"App - Heraclito", "App - Linnaeus", "Learning Object - OACircle", "Learning Object - OATriangle"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		lstRecursos.setSelectedIndex(0);
		scrollPane_2.setViewportView(lstRecursos);
		
		JLabel lblRecursos = new JLabel("Recursos:");
		lblRecursos.setBounds(10, 11, 71, 14);
		pnlRecursos.add(lblRecursos);
		
		JPanel panel = new JPanel();
		panel.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
		panel.setBounds(281, 43, 268, 98);
		pnlRecursos.add(panel);
		panel.setLayout(null);
		
		JRadioButton rdbtnApplication = new JRadioButton("Application");
		rdbtnApplication.setLocation(61, 8);
		rdbtnApplication.setSize(77, 23);
		rdbtnApplication.setSelected(true);
		panel.add(rdbtnApplication);
		
		JRadioButton rdbtnLearningObject = new JRadioButton("Learning Object");
		rdbtnLearningObject.setLocation(140, 8);
		rdbtnLearningObject.setSize(109, 23);
		panel.add(rdbtnLearningObject);
		
		JLabel lblNome_1 = new JLabel("Nome:");
		lblNome_1.setLocation(10, 42);
		lblNome_1.setSize(46, 14);
		lblNome_1.setHorizontalAlignment(SwingConstants.TRAILING);
		panel.add(lblNome_1);
		
		textField_4 = new JTextField();
		textField_4.setLocation(65, 39);
		textField_4.setSize(184, 20);
		panel.add(textField_4);
		textField_4.setColumns(10);
		
		JButton btnNewButton_2 = new JButton("<<-- Incluir");
		btnNewButton_2.setLocation(65, 67);
		btnNewButton_2.setSize(184, 23);
		panel.add(btnNewButton_2);
		
		JLabel lblNovoRecurso = new JLabel("Novo Recurso");
		lblNovoRecurso.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblNovoRecurso.setHorizontalAlignment(SwingConstants.CENTER);
		lblNovoRecurso.setBounds(281, 26, 268, 14);
		pnlRecursos.add(lblNovoRecurso);
		
		JButton btnAtualizaRecursos = new JButton("Atualizar Lista");
		btnAtualizaRecursos.setBounds(10, 206, 100, 23);
		pnlRecursos.add(btnAtualizaRecursos);
		
		JButton btnExcluirRecurso = new JButton("Excluir");
		btnExcluirRecurso.setBounds(127, 206, 100, 23);
		pnlRecursos.add(btnExcluirRecurso);
		
		JPanel pnlPerfis = new JPanel();
		tabbedPane.addTab("Perfis", null, pnlPerfis, null);
		pnlPerfis.setLayout(null);
		
		JScrollPane scrollPane_3 = new JScrollPane();
		scrollPane_3.setBounds(10, 25, 217, 176);
		pnlPerfis.add(scrollPane_3);
		
		JList lstPerfis = new JList();
		lstPerfis.setModel(new AbstractListModel() {
			String[] values = new String[] {"Designer", "Aluno", "Professor", "App Autoria", "App Tutor Inteligente"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		lstPerfis.setSelectedIndex(0);
		scrollPane_3.setViewportView(lstPerfis);
		
		JLabel lblPerfis = new JLabel("Perfis:");
		lblPerfis.setBounds(10, 11, 71, 14);
		pnlPerfis.add(lblPerfis);
		
		JButton button = new JButton("Atualizar Lista");
		button.setBounds(10, 206, 100, 23);
		pnlPerfis.add(button);
		
		JButton button_1 = new JButton("Excluir");
		button_1.setBounds(127, 206, 100, 23);
		pnlPerfis.add(button_1);
		
		JLabel lblAes = new JLabel("A\u00E7\u00F5es:");
		lblAes.setBounds(10, 240, 85, 14);
		pnlPerfis.add(lblAes);
		
		JScrollPane scrollPane_4 = new JScrollPane();
		scrollPane_4.setBounds(10, 256, 200, 86);
		pnlPerfis.add(scrollPane_4);
		
		JList lstAcoesPerfil = new JList();
		lstAcoesPerfil.setModel(new AbstractListModel() {
			String[] values = new String[] {"Learning Object - Control", "Linnaeus - Execute"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		lstAcoesPerfil.setSelectedIndex(0);
		scrollPane_4.setViewportView(lstAcoesPerfil);
		
		JButton button_2 = new JButton("Atualizar Lista");
		button_2.setBounds(10, 347, 100, 23);
		pnlPerfis.add(button_2);
		
		JButton btnExcluirAo = new JButton("Excluir A\u00E7\u00E3o");
		btnExcluirAo.setBounds(113, 347, 100, 23);
		pnlPerfis.add(btnExcluirAo);
		
		JPanel panel_1 = new JPanel();
		panel_1.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
		panel_1.setBounds(264, 194, 353, 176);
		pnlPerfis.add(panel_1);
		panel_1.setLayout(null);
		
		JLabel label = new JLabel("Recursos:");
		label.setBounds(10, 5, 71, 14);
		panel_1.add(label);
		
		JScrollPane scrollPane_5 = new JScrollPane();
		scrollPane_5.setBounds(10, 20, 199, 125);
		panel_1.add(scrollPane_5);
		
		JList lstRecursosAcao = new JList();
		lstRecursosAcao.setModel(new AbstractListModel() {
			String[] values = new String[] {"Learning Object", "Heraclito", "Linnaeus"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		lstRecursosAcao.setSelectedIndex(0);
		scrollPane_5.setViewportView(lstRecursosAcao);
		
		JLabel lblNewLabel = new JLabel("A\u00E7\u00E3o:");
		lblNewLabel.setBounds(219, 5, 46, 14);
		panel_1.add(lblNewLabel);
		
		JList list_1 = new JList();
		list_1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		list_1.setModel(new AbstractListModel() {
			String[] values = new String[] {"Control", "Read", "Write", "Delete", "Execute"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		list_1.setSelectedIndex(0);
		list_1.setBounds(219, 20, 124, 90);
		panel_1.add(list_1);
		
		JButton btnCriaAcao = new JButton("<<-- Incluir A\u00E7\u00E3o");
		btnCriaAcao.setBounds(10, 149, 333, 23);
		panel_1.add(btnCriaAcao);
		
		JPanel panel_2 = new JPanel();
		panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
		panel_2.setBounds(264, 51, 353, 64);
		pnlPerfis.add(panel_2);
		panel_2.setLayout(null);
		
		JLabel lblNomePerfil = new JLabel("Nome Perfil:");
		lblNomePerfil.setHorizontalAlignment(SwingConstants.TRAILING);
		lblNomePerfil.setBounds(36, 10, 64, 14);
		panel_2.add(lblNomePerfil);
		
		textField_5 = new JTextField();
		textField_5.setBounds(105, 7, 201, 20);
		panel_2.add(textField_5);
		textField_5.setColumns(10);
		
		JButton btnIncluirPerfil = new JButton("<< -- Incluir");
		btnIncluirPerfil.setBounds(105, 34, 201, 23);
		panel_2.add(btnIncluirPerfil);
		
		JLabel lblNewLabel_1 = new JLabel("Novo Perfil");
		lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER);
		lblNewLabel_1.setBounds(264, 26, 353, 14);
		pnlPerfis.add(lblNewLabel_1);
		
		JPanel pnlTesteAcesso = new JPanel();
		tabbedPane.addTab("Testes", null, pnlTesteAcesso, null);
		pnlTesteAcesso.setLayout(null);
		
		JScrollPane scrollPane_7 = new JScrollPane();
		scrollPane_7.setBounds(10, 26, 201, 165);
		pnlTesteAcesso.add(scrollPane_7);
		
		JList lstUsuariosTeste = new JList();
		scrollPane_7.setViewportView(lstUsuariosTeste);
		
		JLabel label_2 = new JLabel("Usu\u00E1rios:");
		label_2.setBounds(10, 11, 85, 14);
		pnlTesteAcesso.add(label_2);
		
		JScrollPane scrollPane_8 = new JScrollPane();
		scrollPane_8.setBounds(221, 26, 201, 165);
		pnlTesteAcesso.add(scrollPane_8);
		
		JList lstRecursosTeste = new JList();
		scrollPane_8.setViewportView(lstRecursosTeste);
		
		JLabel label_3 = new JLabel("Recursos:");
		label_3.setBounds(221, 11, 71, 14);
		pnlTesteAcesso.add(label_3);
		
		JList lstAcoesTeste = new JList();
		lstAcoesTeste.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		lstAcoesTeste.setModel(new AbstractListModel() {
			String[] values = new String[] {"Control", "Read", "Write", "Delete", "Execute"};
			public int getSize() {
				return values.length;
			}
			public Object getElementAt(int index) {
				return values[index];
			}
		});
		lstAcoesTeste.setSelectedIndex(0);
		lstAcoesTeste.setBounds(432, 26, 124, 90);
		pnlTesteAcesso.add(lstAcoesTeste);
		
		JLabel label_4 = new JLabel("A\u00E7\u00E3o:");
		label_4.setBounds(432, 11, 46, 14);
		pnlTesteAcesso.add(label_4);
		
		JButton btnSolicitarAcesso = new JButton("Solicitar Acesso");
		btnSolicitarAcesso.setBounds(10, 198, 412, 23);
		pnlTesteAcesso.add(btnSolicitarAcesso);
		
		JLabel lblResposta = new JLabel("Resposta:");
		lblResposta.setBounds(10, 232, 85, 14);
		pnlTesteAcesso.add(lblResposta);
		
		JTextArea txtResposta = new JTextArea();
		txtResposta.setBounds(10, 248, 412, 52);
		pnlTesteAcesso.add(txtResposta);
	}
}
